<!doctype html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>浦东图书馆</title>
  <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
  <script>
    const initWechatSdk = () => {
      let myHeaders = new Headers();

      let requestOptions = {
        method: 'GET',
        headers: myHeaders,
        redirect: 'follow'
      };

      let shareUrl = window.location.href;

      // @ts-ignore
      // fetch("https://weixin.zenosh.com/wechatSdk/sample.php?url=" + encodeURIComponent(shareUrl), requestOptions)
      //   .then(response => response.json())
      //   .then((result) => {
      //     // 通过config接口注入权限验证配置
      //     wx.config({
      //       debug: true,
      //       appId: result.appId,
      //       timestamp: result.timestamp,
      //       nonceStr: result.nonceStr,
      //       signature: result.signature,
      //       openTagList: ['wx-open-launch-weapp'],
      //       jsApiList: [
      //         'checkJsApi',
      //         'openLocation',
      //         'showMenuItems',
      //         // 所有要调用的 API 都要加到这个列表中
      //       ]
      //     });

      //     wx.ready(function () {
      //       console.log('微信sdk已初始化');
      //     })

      //   })
      //   .catch(error => console.log('error', error));
    }

    initWechatSdk()

  </script>
</head>

<body>
  <div id="app"></div>
  <script type="module" src="/src/main.ts"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/eruda/2.3.3/eruda.js"></script>
  <script>
    window.onload = function () {
      eruda.init();
    }
  </script>
</body>

</html>